﻿using SmartHRMS.Infrastructure;
using System;

namespace SmartHRMS.Model.Company
{
    public class Company : BusinessBase<Company>, IAggregateRoot, IEntity
    {
        #region Properties

        public  Guid CompanyId { get;  set; }

        public  string CompanyName { get; set; }

        public  string EstablishDate { get; set; }

        public  string Mission { get; set; }

        public  string Vision { get; set; }

        public  string Slogan { get; set; }

        public  byte[] Logo { get; set; }

        public  CompanyAddress CompanyAddress { get;  set; }

        #endregion

        public Company()
        {
            // Default Constructor required for NHibernate
        }

        public override void validate()
        {

            if (string.IsNullOrEmpty(this.CompanyName))
            {
                this.BrokenRules.Add(new BrokenRule("CompanyName", "Company Name is a required value"));
            }
            else
            {
                if (this.CompanyName.Length > 250)
                {
                    this.BrokenRules.Add(new BrokenRule("CompanyName", "Company Name should be 250 chars or less"));
                }
            }

            if (string.IsNullOrEmpty(this.EstablishDate))
            {
                this.BrokenRules.Add(new BrokenRule("EstablishDate", "Establish Date is a required value"));
            }
            else
            {
                if (this.EstablishDate.Length > 50)
                {
                    this.BrokenRules.Add(new BrokenRule("EstablishDate", "Establish Date should be 50 chars or less"));
                }
            }
   
        }
    }
}
